package com.tarena.lbs.attach.dao.repository.impl;


import com.tarena.lbs.attach.dao.mapper.AttachMapper;
import com.tarena.lbs.attach.dao.repository.AttachRepository;
import com.tarena.lbs.attach.pojo.po.AttachPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


@Slf4j
@Repository
public class AttachRepositoryImpl implements AttachRepository {
    @Autowired
    private AttachMapper attachMapper;

    @Override
    public Integer imageAttach(String imageName) {
        log.info("imageAttach: {}", imageName);
//        创建AttachPO对象
        AttachPO attachPO = new AttachPO();
        attachPO.setFileUuid(imageName);

//        插入或更新附件信息
        attachMapper.insertOrUpdate(attachPO);

        return attachPO.getId();
    }
}
